package com.runnor.common.websys.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.runnor.common.websys.system.entity.SysLog;
import com.runnor.common.websys.system.service.SysLogService;
import com.runnor.common.websys.system.mapper.SysLogMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author runnor
 * @description 针对表【sys_log】的数据库操作Service实现
 * @createDate 2023-08-18 17:35:17
 */
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog>
        implements SysLogService {

    @Autowired
    SysLogMapper sysLogMapper;

    @Override
    public long deleteSyslogByValueAndException(String value, String exception) {
        return sysLogMapper.deleteSyslogByValueAndException(value, exception);
    }

    @Override
    public List<SysLog> download(QueryWrapper<SysLog> queryWrapper) {

        List<SysLog> list = sysLogMapper.selectList(queryWrapper);

        //判断 list 不为Null 在去遍历 赋值 序号
        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                list.get(i).setId(String.valueOf(i + 1));
            }
        }

        return list;
    }
}




